
package com.example.attendancesystem.Interceptor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MvcConfiguration implements WebMvcConfigurer {
    @Autowired
    private MyInterceptor myInterceptor;
    @Autowired
    private MyInterceptor2 myInterceptor2;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(myInterceptor).addPathPatterns("/**")
                .excludePathPatterns("/checkEmpAns")
                .excludePathPatterns("/updateEmpPassByEmpNumber")
                .excludePathPatterns("/getQuesByEmpNum")
                .excludePathPatterns("/login")
                .excludePathPatterns("/imageVerify")
                .excludePathPatterns("/userLogin")
                .excludePathPatterns("/register")
                .excludePathPatterns("/static/**");
        registry.addInterceptor(myInterceptor2)
                .addPathPatterns("/**")
                .excludePathPatterns("/checkEmpAns")
                .excludePathPatterns("/updateEmpPassByEmpNumber")
                .excludePathPatterns("/getQuesByEmpNum")
                .excludePathPatterns("/login")
                .excludePathPatterns("/logout")
                .excludePathPatterns("/imageVerify")
                .excludePathPatterns("/userLogin")
                .excludePathPatterns("/register")
                .excludePathPatterns("/emp/**")
                .excludePathPatterns("/static/**");;

    }

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/**").addResourceLocations("classpath:/static/");

    }

}



